import numpy as np
import sklearn.preprocessing as prep
from sklearn.decomposition import PCA

def random_shuffle_whole_supervised_data(train_X,train_y):
    train_data = np.hstack((train_X,train_y))
    np.random.shuffle(train_data)
    return train_data[:,0:len(train_data.transpose())-1],train_data[:,len(train_data.transpose())-1]

def scale_X(X):
    return prep.scale(X)

def log_X(X):
    return np.log(np.abs(X))

def PCA_X(X,features = 500):
    pca = PCA(n_components=features)
    pca.fit(X.transpose())
    return pca.components_.transpose()

